package com.hzz.dao.eybase;

import com.hzz.framework.dao.IBaseDao;
import com.hzz.framework.entity.IEntity;
import org.apache.ibatis.annotations.*;

import java.util.List;
import java.util.Map;

/**
 * <p>ey_河段和河长关系 数据库处理接口类。
 */
@Mapper
public interface IEyBaseRetrieveGmHydlDao extends IBaseDao {

    /**
      * 判断是否存在
      */
    @Override
    @Select("select IFNULL(count(0),0) as count from ey_base_retrieve_gm_hydl where  gid = #{gid} ")
    int isDataExist(IEntity entity) throws Exception;

    /**
     * 根据主键 物理删除
     */
    @Override
    @Delete("delete from ey_base_retrieve_gm_hydl where  gid = #{gid} ")
    int deleteByPrimaryKey(IEntity entity) throws Exception;

    int dataStatistics(IEntity entity) throws Exception;

    @Delete("delete from ey_base_retrieve_gm_hydl where IFNULL(datediff(DATE_FORMAT(now(),'%Y%m%d'),DATE_FORMAT(date_created,'%Y%m%d')),999)>#{expireDay} ")
    int deleteByExpireDay(@Param("expireDay") Integer expireDay) throws Exception;

}
